package com.yunxi.service.dubboService.impl.finance;

import com.github.pagehelper.PageInfo;
import com.yunxi.finance.pojo.VehiclePriceTypeVO;
import com.yunxi.finance.service.VehiclePriceTypeDubboService;
import com.yunxi.model.finance.VehiclePriceType;
import com.yunxi.service.localService.finance.VehiclePriceTypeService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import java.lang.reflect.InvocationTargetException;
import java.util.List;

/**
 * <p>
 * 车辆价格类型 服务实现类
 * </p>
 *
 * @author
 * @since 2019-05-21
 */
public class VehiclePriceTypeDubboServiceImpl implements VehiclePriceTypeDubboService {

    @Autowired
    @Qualifier(value = "vehiclePriceTypeServiceImpl")
    VehiclePriceTypeService vehiclePriceTypeService;


    @Override
    public VehiclePriceTypeVO getById(String id) throws InvocationTargetException, IllegalAccessException {
        VehiclePriceType vehiclePriceType = vehiclePriceTypeService.getById(id);
        VehiclePriceTypeVO vehiclePriceTypeVO = new VehiclePriceTypeVO();
        BeanUtils.copyProperties(vehiclePriceType, vehiclePriceTypeVO);
        return vehiclePriceTypeVO;
    }

    @Override
    public void saveOrUpdate(VehiclePriceTypeVO VehiclePriceTypeVO) throws InvocationTargetException, IllegalAccessException {
        VehiclePriceType VehiclePriceType = new VehiclePriceType();
        BeanUtils.copyProperties(VehiclePriceTypeVO, VehiclePriceType);
        vehiclePriceTypeService.saveOrUpdate(VehiclePriceType);
    }

    @Override
    public void removeById(String id) {
        vehiclePriceTypeService.removeById(id);
    }

    @Override
    public PageInfo<VehiclePriceTypeVO> findPageByVO(VehiclePriceTypeVO vehiclePriceTypeVO, Integer pageNum, Integer pageSize) throws InvocationTargetException, IllegalAccessException {

        PageInfo<VehiclePriceTypeVO> pageInfo = vehiclePriceTypeService.pageByVo(vehiclePriceTypeVO, pageNum, pageSize);

        return pageInfo;

    }

    @Override
    public void removeByListVo(List<VehiclePriceTypeVO> vehiclePriceTypeVOList) throws IllegalAccessException, InvocationTargetException, InstantiationException {
        vehiclePriceTypeService.removeByListVo(vehiclePriceTypeVOList);
    }

    @Override
    public List listByVo(VehiclePriceTypeVO vehiclePriceTypeVO) {
        return vehiclePriceTypeService.listByVo(vehiclePriceTypeVO);
    }
}
